<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="strutsTags"%>
<%@ page import="java.net.InetAddress" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
<%
			response.setHeader("Pragma", "No-cache");
			response.setHeader("Cache-Control", "no-cache");
			response.setDateHeader("Expires", 0);
		%>
		<base href="<%=basePath%>">

		<style type="text/css">
<!--
body {
	background-color: #f9f9f5;
	text-align: center;
}

.formtable td {
	font-size: 12px;
	height: 20px;
}

.required,.errorMessage {
	color: red;
	font-weight: normal;
	text-align: left;
}
-->
</style>

		<title>登录</title>
	</head>
	<body onload="onloadFunction();">
		<br />
		<br />
		<br />
		<table border=0 cellpadding=0 cellspacing=0 width=100% height=80%>
			<tr>
				<td width=100%>
					<table width="594" border="0" cellspacing="0" cellpadding="0" align=center>
						<tr>
							<td>
								<img src="resource/images/login_top.gif" width="594"
									height="59" /></td>
						</tr>
						<tr>
							<td background="resource/images/login_bg.gif">
								<form name="loginForm" action="configuration/dologin.action"
									method="post" namespace="/configuration">
                                    <s:hidden id = "macAddress" name="macAddress"/>
									<table align="center" class="formtable" cellpadding="5"
										width="350" height="289">
										<tr>
											<td colspan="3" align="center">
											<span class="errorMessage">
                                      <s:iterator value="actionErrors">
														<s:property />
													</s:iterator> 
													</span></td>
										</tr>

										<tr>
											<td align="left">
												用户名：
											</td>
											<td colspan=2>
												<s:textfield id="uiUsername" name="user.uiUsername"
													value="" size="20" required="true" />
											</td>
										</tr>
										<tr>
											<td align="left">
												密 码：
											</td>
											<td colspan=2>
												<s:password id="uiPassword" name="uiPassword"
													showPassword="true" value="" required="true" />
											</td>
										</tr>
										<tr>
											<td align="left">
												<label>
													验证码：
												</label>
											</td>
											<td>
												<s:textfield id="checkCode" name="checkCode" required="true" size="8"
													maxlength="4" />
                                           </td>
<td><img src="servlet/CheckCodeServlet" />
</td>
										</tr>
										<tr>
											<td colspan="3" align="center">
												<input class="button" onclick="return checkMac();" type="submit" value="登录">
												&nbsp;&nbsp;&nbsp;&nbsp;
												<input class="button" type="reset" value="重置" />
											</td>
										</tr>
									</table>
<table align="center" class="formtable" cellpadding="5" width="50%"/>            
		            <tbody id="localTable"></tbody>
		 </table>
								</form>
							</td>
						</tr>
						<tr>
							<td>
								<img src="resource/images/login_bot.gif" width="594"
									height="12" /></td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
<script language="javascript">
	/* end  :*******************************************************/
	
	function doCopy(){
		if(window.clipboardData){
			window.clipboardData.setData('Text',document.getElementById('url').value);
		}
	}
		
	function checkMac(){
		var myName = document.getElementById("uiUsername").value;
		var myPassword = document.getElementById("uiPassword").value;
		var checkCode = document.getElementById("checkCode").value;
		
		if(myName == null||myName == ''){
			alert("请输入用户名");
			return false;
			}
		if(myPassword == null||myPassword == ''){
			alert("请输入用户密码");
			return false;
		}
		if(checkCode == null||checkCode == ''){
			alert("请输入验证码");
			return false;
			}
		
		var theName = myName +'macAddress';
		
	    var oldMac =  hrm.common.getCookie(theName);
	    
	   
	    var generateMac = document.getElementById("macAddress").value;
	    
	    if(generateMac !=null && generateMac.length == 17 && oldMac == null){
	    	hrm.common.setCookie(theName,generateMac,1068,'/');
	    }
	    var mac = hrm.common.getCookie(theName);
	   
	    document.getElementById("macAddress").value = mac;
	    
	    return true;
	}			
	// 刷新父页面，如果已经登出，用户仍旧调用数据导入功能，出错时只刷新隐藏页面，始终为“正在处理”，看不到登陆页面
	if(parent.document!=document && parent.document.location.host==document.location.host){
		parent.document.location.href=parent.document.location.href;
	}
</script>
	</body>
</html>